var util = {
	selectDept: function(p){
		p = $.extend({text: '确定', onclick: function (item, dialog) { 
			var checkedNode = dialog.frame.getCheckedDeptNodes();
			if(!checkedNode || checkedNode.length > 1){
				alert("请选择一个部门");
				return;
			}
			if(!checkedNode.pId){
				alert("请不要选择公司作为部门");
				return;
			}
			addRelativeToObject({"dept_name": checkedNode.name, "dept_id": checkedNode.id});
			dialog.close(); 
		}}, p  || {});
		var url = base + '/manager/s_dept!deptTree.action?style=2';
		if (p.filterId) {
			url = url + "?filterId=" + p.filterId;
		}
		if(p.style){
			if(url.indexOf("?") != -1){
				url = url + "&style=" + p.style;
			}else{
				url = url + "?style=" + p.style;
			}
			
		}
		$.ligerDialog.open({ url: url, 
			height: 400,
			width: 260, 
			title: '选择部门',
			buttons: [p,{ text: '取消', onclick: function (item, dialog) { 
				dialog.close(); 
			} } ] 
		});
	}
};
